#ifndef __VXI_11_H_
#define __VXI_11_H_

#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <time.h>

enum ERR_CODE{
	DEC_NE = 0,				// No error
	DEC_SE = 1,				// Syntax error
	DEC_DNA = 3,			// device not accessible
	DEC_ILI = 4,			// invalid link identifier
	DEC_PE = 5,				// parameter error
	DEC_CNE = 6,			// channel not established
	DEC_ONS = 8,			// operation not supported
	DEC_OOS = 9,			// out of resources
	DEC_DLBAL = 11,			// device locked by another link
	DEC_NLHBTL = 12,		// no lock held by this link
	DEC_IOTO = 15,			// I/O timeout
	DEC_IOE = 17,			// I/O error
	DEC_IA = 21,			// Invalid address
	DEC_A = 23,				// abort
	DEC_CAE = 29,			// channel already established
};

typedef int BOOL;

#define RET_ERR_TIMEOUT		-1
#define RET_ERR_NULL_ARGU	-2
#define RET_ERR_BUF_OV	-3
#define RET_ERR_IO			-4

#define CMD_SHM_SIZE (4 * 1024)
#define RSP_SHM_SIZE (4 * 1024)

int vxi_ii_w_cmd_s(const char *cmd_buf, struct timeval *tv);
int vxi_ii_w_cmd(const char *cmd_buf, struct timeval *tv, size_t size);
int vxi_ii_r_cmd(char *cmd_buf, size_t size);
int vxi_ii_w_rsp_s(const char *resp_buf);
int vxi_ii_w_rsp(const char *resp_buf, size_t size);
int vxi_ii_r_rsp(char *resp_buf, struct timeval *tv, size_t size);
int cmd_sem_init();
int rsp_sem_init();
int cmd_shm_init();
int rsp_shm_init();

#ifdef __cplusplus
}
#endif
#endif
